<script setup >
import { ref, reactive } from "vue";

import { findCollect, findHistory } from "@/api/user";

const collectGoods = ref([]);
findCollect({ page: 1, pageSize: 4 }).then((res) => {
  collectGoods.value = res.items;
});

findHistory({ page: 1, pageSize: 4 }).then((res) => {
  goods.value = res.items;
});
const goods = ref([]);
</script>

<template>
  <div class="member-home">
    <!-- 概览 -->
    <overview></overview>
    <!-- 收藏 -->
    <member-panel title="我的收藏">
      <p v-if="!collectGoods.length">暂无收藏</p>
      <div v-else>
        <goods-item
          v-for="(item, index) in collectGoods"
          :key="index"
          :goods="item"
        ></goods-item>
      </div>
    </member-panel>
    <!-- 组件 -->
    <member-panel title="我的足迹">
      <goods-item
        v-for="(item, index) in goods"
        :key="index"
        :goods="item.spu"
      ></goods-item>
    </member-panel>
    <!-- 猜你喜欢 -->
    <goods-relevant></goods-relevant>
  </div>
</template>

<style scoped lang='less'>
.member-home {
}
</style>